#include <iostream>
#include <string>
//
// Created by Asus on 2025/6/2.
//
using namespace std;

void demo01() {
    string str = "hello world";
    for (int i = 0; i < str.size(); i++) {
        cout << str[i] << " ";
    }
    cout << endl;
    for (int i = 0; i < str.size(); i++) {
        cout << str.at(i) << " ";
    }
    cout << endl;

    // 字符修改
    str[0] = 'x';
    str.at(1) = 'y';
    cout << "str: " << str << endl;
}

int main(int argc, char *argv[]) {
    demo01();
    return 0;
}
